package com.jhmk.springboot.utils;

import com.jhmk.springboot.exception.ParamsException;
import org.apache.commons.lang3.time.DateUtils;
import org.assertj.core.util.DateUtil;

import java.text.ParseException;
import java.util.Date;

public class AssertUtil {
    public static void isTrue(Boolean flag,String msg){

    if (flag)
        throw new ParamsException(msg);
    }

    public static Date TransDate(String date){
        //
        String format="yyyy-MM-dd HH:mm:ss";
        try {
          return   DateUtils.parseDate(date,format);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return new Date();
    }
}
